package com.owulia.coffee.entity.mysql;

import com.owulia.coffee.commons.base.BaseEntity;
import com.owulia.coffee.entity.enums.OrderState;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

@Entity
@Table(name = "t_order")
@Builder
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class Order extends BaseEntity implements Serializable{
    @ManyToMany
    @JoinTable(name = "t_order_coffee")
    @OrderBy("id")
    //查找内部数组使用单个单词命名
    private List<Coffee> items;
    private String customer;

    @Enumerated
    @Column(nullable = false)
    private OrderState state;
}
